package org.x.common.config;

/**
 * 自定义业务异常
 */
public class BusinessException extends RuntimeException {

    int code;
    String message;

    public BusinessException(int code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public BusinessException(int code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
        this.message = message;
    }

    public BusinessException(int code, Throwable cause) {
        super(cause);
        this.code = code;
        this.message = cause.getMessage();
    }

    public BusinessException(String message,Throwable cause) {
        super(message);
        this.code = 500;
        this.message = message;
    }

    public BusinessException(String message) {
        super(message);
        this.message = message;
        this.code = 500;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
